//
//  Bundle+Helper.swift
//  SwiftWeibo
//
//  Created by suqianghotel on 16/11/14.
//  Copyright © 2016年 suqianghotel. All rights reserved.
//

import Foundation


extension Bundle
{
    
    var namespace : String {
        return infoDictionary?["CFBundleName"] as? String ?? ""
    }
    
    var version : String {
        return infoDictionary?["CFBundleInfoDictionaryVersion"] as? String ?? ""
    }
    
    var lastVersion: String  {
        return UserDefaults.standard.string(forKey: "lastVersion") ?? ""
    }
    
    var isNewVersion:Bool
    {
        return self.version != self.lastVersion
    }
    
    func saveVersion() -> () {
        UserDefaults.standard.set(self.version, forKey: "lastVersion")
    }
    
    
}
